n=int(input())

number=0

a=[0,0,0,0]

while True:
    for i in range(0,4):
        number+=1
        if number%7==0 or str(number).find("7")!=-1:
            a[i]+=1
        else:
            n-=1
            if n==0:
                for item in a:
                    print(item)
                exit(0)
